import { queryAllTagList } from "@/api/content/tag";
import { Tag } from "@/types/content/tag";
import { useCallback, useEffect, useState } from "react";



export const useTagList = () => {
  const [tagsList, setTagsList] = useState<Array<Tag.Row>>([]);
  /**
   * 获取标签列表
   */
  const getTagsList = useCallback(async () => {
    const res = await queryAllTagList();
    if (res.code === 200) {
      setTagsList(res.data || []);
    }
  }, [])
  useEffect(() => {
    getTagsList()
  }, [getTagsList])
  return {
    tagsList,
  };
};
